﻿namespace UtilZ.Dotnet.Ex.Model
{
    /// <summary>
    /// 数据源扩展类型接口
    /// </summary>
    public interface IDataSourceExtend
    {
        /// <summary>
        /// 数据长度字节数
        /// </summary>
        int Length { get; }

        /// <summary>
        /// 读取数据到buffer中
        /// </summary>
        /// <param name="buffer">数据缓存</param>
        /// <param name="offset">存储数据起始索引</param>
        /// <param name="count">读取数据长度</param>
        /// <param name="readOffset">数据源读取数据起始位置</param>
        void Read(byte[] buffer, int offset, int count, int readOffset);

        /// <summary>
        /// 将数据写到buffer中
        /// </summary>
        /// <param name="buffer">数据缓存</param>
        /// <param name="offset">存储数据起始索引</param>
        /// <param name="count">写入数据长度</param>
        /// <param name="writeOffset">数据源写入数据起始位置</param>
        void Write(byte[] buffer, int offset, int count, int writeOffset);
    }

}
